package com.yb.guigu.pick.core.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/6/7 13:09
 * FileName: PermissionConstant
 * Description:
 */
public class PermissionConstant {

    @Getter
    @AllArgsConstructor
    public enum IsMenu{
        NO(0,"不是菜单，是路由"),
        YES(1,"是菜单");
        private Integer value;
        private String  description;
    }


    @Getter
    @AllArgsConstructor
    public enum Type{

        SIMPLE(0,"sys:simple:","普通权限"),

        ROUTE(1,"sys:route:","路由"),

        MENU(2,"sys:menu:","菜单"),

        INTERFACE(3,"sys:api:","接口权限");

        private Integer value;
        private String prefix;
        private String  description;

        public static Type parse(Integer isMenu){
            if(Objects.isNull(isMenu))return null;
            if(RouteConstant.IsMenu.YES.getValue().equals(isMenu)){
                return MENU;
            }else if(RouteConstant.IsMenu.NO.getValue().equals(isMenu)){
                return ROUTE;
            }else{
                return null;
            }

        }
    }

}
